// CyTargetLinker RIN conversion,
//
// scripts to create RIN network files for several online databases
// can be used with the CyTargetLinker app for Cytoscape
//
// Copyright 2011-2013 Department of Bioinformatics - BiGCaT, Maastricht University
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

package cytargetlinker.conversion.data;

import cytargetlinker.conversion.graph.Graph;
import cytargetlinker.conversion.graph.Graph.Edge;

/**
 * Class that represents a microRNA-target interaction
 * source of the interaction is MiRNANode
 * target of the interaction is GeneNode
 * an interaction can have a score, pvalue and pubmed identifier
 * the interaction class is microRNA-target
 * the datasource property should state where the interaction information comes from
 * 
 * @author martina
 *
 */
public class MTI {

	private MiRNANode source;
	private GeneNode target;
	private String score;
	private String pvalue;
	private String interactionClass = "microRNA-target";
	private String pubmedId;
	
	public MTI(MiRNANode source, GeneNode target, String score, String pvalue, String pubmedId) {
		super();
		this.source = source;
		this.target = target;
		this.score = score;
		this.pvalue = pvalue;
		this.pubmedId = pubmedId;
	}
	
	public Edge createEdge(Graph graph, String datasource, int count) {
		Edge e = graph.addEdge("" + count, source.getNode(graph), target.getNode(graph));
		if(!score.equals("")) e.setAttribute("score", getScore().toString());
		if(!pvalue.equals("")) e.setAttribute("pValue", pvalue);
		if(!pubmedId.equals("")) e.setAttribute("pubmedId", pubmedId);
		e.setAttribute("interactionType", getInteractionClass());
		e.setAttribute("datasource", datasource);
		return e;
	}
	
	
	// SETTERS & GETTERS
	
	public MiRNANode getSource() {
		return source;
	}
	public GeneNode getTarget() {
		return target;
	}
	public String getScore() {
		return score;
	}
	public String getInteractionClass() {
		return interactionClass;
	}
	public String getPvalue() {
		return pvalue;
	}
	public String getPubmedId() {
		return pubmedId;
	}
}
